package com.situ.mall.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.situ.mall.base.util.C;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author darling
 * @since 2023-03-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_attachment")
public class Attachment implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 访问地址
     */
    private String path;

    /**
     * 上传时间
     */
    private LocalDateTime createtime;

    /**
     * 原文件名
     */
    private String fileName;

    /**
     * 文件大小
     */
    private String fileSize;

    /**
     * 源
     */
    private String source;

    /**
     * 源ID
     */
    private Integer sourceId;

    /**
     * 排序规则
     */
    private Integer sort;

    /**
     * 类型
     */
    private String type;

    @TableField(exist = false)
    private String pathView;

    public String getPathView(){
        return C.UPLOAD_PATH_PREFIX + path;
    }


}
